package controllers;

import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Vector;
import javax.naming.InitialContext;
import javax.swing.JOptionPane;

import messages.LoginMessage;
/*import Gui.ReturnsReport;
import Gui.LibrarianWindow;
import Gui.ActivityReport;
import Gui.AddBook;
import Gui.Chartmake;
import Gui.DirectorWindow;
import Gui.EditDetails;
import Gui.FreezeSubscriber;
import Gui.Histogram;
import Gui.LendHistogram;
import Gui.LendReport;
import Gui.LendingCard;
import Gui.MainScreen;
import Gui.ReturnsReport;
import Gui.Rigester;
import Gui.Search;
import Gui.SubscriberWindow;
import Gui.UpdateBookDetails;
import Gui.Viewlending;
import Gui.Viewsubscriberdetail;
import Gui.Workers;  */
import entity.UserLoginInfo;
//import Logic.TaskAssignment;
//import Gui.TheBookIsCopy;
import ocsf.client.AbstractClient;
import ocsf.server.ConnectionToClient;
/**
 * this class get answer from the server 
 */

public class ClientController extends AbstractClient {
	public static Object togui;
	LoginMessage loginMsg;

	
	  
	public ClientController(String host, int port) throws IOException {
		super(host, port);
		openConnection();
	}

	
	public void handleMessageFromGui(Object msg )
	  {
	    try
	    {
	    	sendToServer(msg);
	    }
	    catch(IOException e)
	    {
	 
	       System.out.println("Can't send message to server...  Terminating client...");
	      e.printStackTrace();
	      quit();
	    }
	  }
	  
	  /**
	   * This method terminates the client.
	   */
	  public void quit()
	  {
	    try
	    {
	      closeConnection();
	    }
	    catch(IOException e) {}
	    System.exit(0);
	  }
	  
	 
		@Override
		protected void handleMessageFromServer(Object msg) {
			// TODO Auto-generated method stub
			
		}
	  
}


	
